#include "BaseObject.h"
#include "MainLayer.h"
#include "Bullet.h"

#define DEBUG_BOUNDDRAW 0

BaseObject::BaseObject(void)
{
}


BaseObject::~BaseObject(void)
{
}

bool BaseObject::init()
{
	if (!CCNode::init())
		return false;

	return true;
}

MainLayer* BaseObject::getMainLayer()
{
	return dynamic_cast<MainLayer*>(getParent());
}

void BaseObject::shoot( Bullet* bullet )
{

}

cocos2d::CCPoint BaseObject::getPositionCenter()
{
	return ccp(this->boundingBox().getMidX(), this->boundingBox().getMidY());
}

void BaseObject::draw()
{
	CCNode::draw();

if (DEBUG_BOUNDDRAW == 1)
{
	CCRect boundBox = boundingBox();
	// draw bounding box
	CCPoint vertices[4]={
		ccp(0, boundBox.size.height),
		ccp(0, 0),
		ccp(boundBox.size.width, 0),
		ccp(boundBox.size.width, boundBox.size.height),
	};
	ccDrawPoly(vertices, 4, true);
}
}
